Search
Disable the Global Cart on specified sites in the MultiSite Network - WP Global Cart
15255
post-template-default,single,single-post,postid-15255,single-format-standard,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.0,eltd-smooth-scroll,eltd-smooth-page-transitions,eltd-mimic-ajax,eltd-grid-1200,eltd-blog-installed,eltd-default-style,eltd-fade-push-text-top,eltd-header-standard,eltd-sticky-header-on-scroll-down-up,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-menu-item-first-level-bg-color,eltd-dropdown-slide-from-top,eltd-,eltd-fullscreen-search eltd-search-fade,eltd-side-menu-slide-from-right,wpb-js-composer js-comp-ver-6.3.0,vc_responsive
 

Disable the Global Cart on specified sites in the MultiSite Network

WP Global Cart / Articles  / Disable the Global Cart on specified sites in the MultiSite Network
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

Disable the Global Cart on specified sites in the MultiSite Network

The WooCommerce Global Cart plugin code is cleverly built using the latest programming techniques, this allows high flexibility for the modules.

The Global Cart is the most important feature that the plugin can provide.  As default, this is available on all network, whenever WooCommerce is available. In certain set-ups, not all shops are required to run a GlobalCart functionality, so might be required to be disabled. This can be achieved easily through a filter code.

The following sample code demonstrates how to disable the functionality for specified sites. The code should be placed within a file inside /wp-content/mu-plugins/ folder:

 


    /**
    * Disable the Global Cart for sites ID 3 and 4    
    */
    define ( 'WooGC_GC_Ignore_Sites', array( 3, 4 ) );
         
    add_filter( 'woogc/disable_global_cart',     'WooGC_Disable_GlobalCart');
    function  WooGC_Disable_GlobalCart ( $status )
        {
            
            global $blog_id;
            
            if (  in_array( $blog_id, WooGC_GC_Ignore_Sites ))
                return TRUE;   
                
            return $status;
            
        }
        
    add_filter( 'woogc/save_session_data/ignore_sites',     'WooGC_Save_Session_Data');
    function  WooGC_Save_Session_Data ( $sites  =   array() )
        {
                
            return WooGC_GC_Ignore_Sites;
            
        }

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x